package com.spring.sunflower.main.adapter;

import android.widget.ImageView;

import androidx.recyclerview.widget.RecyclerView;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.spring.sunflower.R;
import com.spring.sunflower.bean.RecommendAnchorsBean;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.List;

/**
 * Created by Kevin on 2021/6/1<br/>
 * <p>
 * Describe:<br/>
 */
public class LivelyAdapter extends BaseQuickAdapter<RecommendAnchorsBean.DatasBean, BaseViewHolder> {


    @Override
    public void onAttachedToRecyclerView(@NotNull RecyclerView recyclerView) {
        super.onAttachedToRecyclerView(recyclerView);
    }

    public LivelyAdapter(int layoutResId, @Nullable List<RecommendAnchorsBean.DatasBean> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(@NotNull BaseViewHolder baseViewHolder, RecommendAnchorsBean.DatasBean recommendAnchorsBean) {
        Glide.with(getContext())
                .load(recommendAnchorsBean.getCoverUrl())
                .into((ImageView) baseViewHolder.getView(R.id.ivCover));
        baseViewHolder.setText(R.id.tvName, recommendAnchorsBean.getNickname());
        baseViewHolder.setText(R.id.tvAge, recommendAnchorsBean.getAge()+"岁");
        baseViewHolder.setText(R.id.tvHouse, recommendAnchorsBean.getCity());
    }
}
